/**
 * @description: vue hook 用法测试
 * @param {number} init
 * @return {*}
 */
import { computed, ref } from 'vue'
export default function useCount(init: number) {
  const count = ref(init)
  const increase = () => { count.value++ }
  const decrease = () => { count.value-- }
  const reset = () => { count.value = init }
  const set = (v: number) => { count.value = v }
  const doubleCount = computed(() => count.value * 2)
  function increment() {
    count.value++
  }
  return { count, increase, decrease, reset, set, doubleCount, increment }
}

// 导入用法：import useCount from './useCount'
// 默认导出，不需要大括号

// tokenM.ts 中，导入用法：import { tokenM } from './tokenM'
// 命名导出，需要大括号